package com.sneakxy.cloudbase.platform.seata;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class CloudBaseSeataBeanPostProcessor implements BeanPostProcessor {

	private final CloudBaseSeataFeignObjectWrapper seataFeignObjectWrapper;

	public CloudBaseSeataBeanPostProcessor(CloudBaseSeataFeignObjectWrapper seataFeignObjectWrapper) {
		this.seataFeignObjectWrapper = seataFeignObjectWrapper;
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName)
			throws BeansException {
		return this.seataFeignObjectWrapper.wrap(bean);
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName)
			throws BeansException {
		return bean;
	}
	
}
